// pages/insurance/insuranceDetail/insuranceDetail.js
Page({

    /**
     * 页面的初始数据
     */
    data: {
        current: 0,
        mainInsurance: [{
                check: true,
                name: "交叉险 + 车船税",
                detail: "代收",
                index: 0
            },
            {
                check: true,
                name: "第三者责任险",
                detail: "理赔第三方",
                index: 1
            },
            {
                check: true,
                name: "车辆损失险",
                detail: "理赔本车",
                index: 2
            },
            {
                check: true,
                name: "车上人员责任险",
                detail: "司机乘客理赔",
                index: 3
            },
            {
                check: true,
                name: "各项不计免赔",
                detail: "100%理赔",
                index: 4
            }
        ],
        extraInsurance: [{
                check: true,
                name: "全车盗抢损失险",
                index: 0
            },
            {
                check: true,
                name: "车身油漆达拿度损伤险",
                index: 1
            },
            {
                check: true,
                name: "自燃险",
                index: 2
            },
            {
                check: true,
                name: "发动机特别损失险",
                index: 3
            },
            {
                check: true,
                name: "指定专修厂特约",
                index: 4
            },
            {
                check: true,
                name: "玻璃单独破损险",
                index: 5
            }
        ],
    },

    /**
     * 生命周期函数--监听页面加载
     */
    selectCompany0: function() {
        var that = this;
        that.setData({
            current: 0
        })
    },
    selectCompany1: function() {
        var that = this;
        that.setData({
            current: 1
        })
    },
    selectCompany2: function() {
        var that = this;
        that.setData({
            current: 2
        })
    },
    checkImage: function(e) {
        var that = this;
        var index = e.currentTarget.dataset.index
        var mainInsurance = that.data.mainInsurance
        if (mainInsurance[index].check) {
            mainInsurance[index].check = false;
        } else {
            mainInsurance[index].check = true;

        }
        that.setData({
            mainInsurance
        })
    },
    checkExtra: function(e) {
        var that = this;
        var index = e.currentTarget.dataset.index
        var extraInsurance = that.data.extraInsurance
        if (extraInsurance[index].check) {
            extraInsurance[index].check = false;
        } else {
            extraInsurance[index].check = true;

        }
        that.setData({
            extraInsurance
        })
    },


    onLoad: function(options) {

    },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function() {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function() {

    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function() {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function() {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function() {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function() {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function() {

    }
})